<template>
    <div id="compliance-clause" class="move-box">
        <!-- 左侧菜单栏 -->
        <template>
            <EntryLeftModule
                v-show="state"
                type="指标中心"
                ref="left-tree"
                :fileDataSource="fileSourceCategoryData"
                :productDataSource="productDataSource"
                :clauseSourceCode="clauseQueryParam.clauseCode"
                :currentNodeFilekey="currentNodeFilekey"
                :currentNodeProductkey="currentNodeProductkey"
                :treeExpandKeys="treeExpandKeys"
                :treeExpandKeys2="treeExpandKeys2"
                @emitIconEdit="emitIconEdit"
                @emitIconEditOutline="emitIconEditOutline"
                @emitIconPlus="emitIconPlus"
                @emitIconTime="emitIconTime"
                @handleNodeClick="handleNodeClick"
                @handleNodeClickPro="handleNodeClickPro"
                @emitTabpaneType="emitTabpaneType"
                @emitIconEditTest="emitIconEditTest"
                @emitNodeEdit="emitNodeEdit"
            >
                <template slot="title">
                    <!-- <HeaderTitle>
                        <div slot="title" v-if="tabPaneType == 'File'">{{ headerTitle }}</div>
                        <div slot="title" v-if="tabPaneType == 'Product'">{{ headerTitle2 }}</div>
                    </HeaderTitle> -->

                    <span style="font-size: 14px; color: rgb(51, 51, 51); font-weight: 700; padding-left: 20px">合规来源</span>
                </template>
            </EntryLeftModule>
        </template>
        <!-- 右侧内容框 -->
        <template>
            <div class="content silder-right">
                <!-- 收缩按钮图标 -->
                <div class="toggle-btn" :class="state ? '' : 'toggle-btn-right'" @click="toggleBtm">
                    <div class="shrink-right-icon">
                        <i style="color: #fff" :class="state ? 'el-icon-arrow-left' : 'el-icon-arrow-right'"></i>
                    </div>
                </div>
                <el-tabs v-model="activeTab" class="content-tabs" @tab-click="handleTabChange">
                    <el-tab-pane v-if="tabPaneType == 'File'" :label="tabLabel1" name="source">
                        <!-- <SourceDocumentDialog
                            :MenuName="MenuNameCopy"
                            :addSourceDialog="addSourceDialog"
                            :indexItem="indexItem"
                            :indexClauseList="indexClauseList"
                            @emitSource="emitSource"
                            @emitHandleVaild="emitHandleVaild"
                            @emitAddSourceDialog="emitAddSourceDialog"
                            @emitAddFileSourceCategoryNode="getFileSourceCategoryData"
                        ></SourceDocumentDialog> -->
                        <Source
                            ref="source"
                            :treeCurrentData="treeNodeData"
                            :MenuName="MenuNameCopy"
                            :indexItem="indexItem"
                            @enableClause="enableClause('导入')"
                            @emitSource="emitSource2"
                            @emitHandleVaild="emitHandleVaild"
                            @deleteAllList="deleteAllList"
                        />
                    </el-tab-pane>
                    <el-tab-pane :label="tabLabel2" name="clause">
                        <!-- 合规条款 -->
                        <div class="content-top">
                            <div class="operate" style="height: 100%">
                                <div class="operate-btn">
                                    <div class="leftBtn">
                                        <el-button
                                            v-if="tabPaneType == 'File'"
                                            :disabled="addDisabled"
                                            type="primary"
                                            icon="el-icon-plus"
                                            size="mini"
                                            @click="handleClauseBtn(MenuName + '新增')"
                                        >
                                            新增
                                        </el-button>
                                        <el-button v-if="tabPaneType == 'File'" size="mini" @click="delClauseDialog(clauseCodes, '批量删除')">
                                            批量删除
                                        </el-button>
                                        <el-button
                                            v-if="['监管类', '制度解读类'].includes(MenuName) && tabPaneType == 'File'"
                                            :disabled="treeNodeData.id == '1'"
                                            :key="treeNodeData.id"
                                            size="mini"
                                            @click="handleClauseBtn('复制')"
                                        >
                                            迁移复制
                                        </el-button>
                                        <el-button
                                            v-show="MenuName === '合同类' && tabPaneType == 'File'"
                                            :disabled="treeNodeData.level != 4"
                                            size="mini"
                                            @click="handleProductClauseBtn('复制')"
                                        >
                                            迁移复制
                                        </el-button>
                                        <div class="separator1"></div>
                                        <el-button
                                            v-if="['监管类', '合同类', '制度解读类'].includes(MenuName)"
                                            size="mini"
                                            @click="enableClause('启用')"
                                        >
                                            启用
                                        </el-button>
                                        <el-button
                                            v-if="['监管类', '合同类', '制度解读类'].includes(MenuName)"
                                            size="mini"
                                            @click="enableClause('停用')"
                                        >
                                            停用
                                        </el-button>
                                        <el-button
                                            v-if="['合同类'].includes(MenuName)"
                                            size="mini"
                                            @click="handleHsOrSh('恒生交易系统待办')"
                                            :style="{ background: taskType2 ? '#dcae59' : '', color: taskType2 ? 'white' : '' }"
                                        >
                                            恒生交易系统待办
                                        </el-button>
                                        <el-button
                                            v-if="['合同类'].includes(MenuName)"
                                            size="mini"
                                            @click="handleHsOrSh('事后系统待办')"
                                            :style="{ background: taskType3 ? '#dcae59' : '', color: taskType3 ? 'white' : '' }"
                                        >
                                            事后系统待办
                                        </el-button>
                                    </div>
                                    <div class="rightBtn" style="min-width: 380px; width: 35%" :style="{ width: tabPaneType == 'File' ? '35%' : '' }">
                                        <el-input
                                            size="mini"
                                            v-model="clauseQueryParam.clauseTextLike"
                                            prefix-icon="el-icon-search"
                                            :placeholder="MenuName == '制度解读类' ? '请输入制度条款' : '请输入条款原文'"
                                            style="margin-right: 10px; width: calc(100% - 310px)"
                                            @input="clauseTextLikeQuery"
                                            v-if="tabPaneType == 'File'"
                                        />
                                        <el-input
                                            size="mini"
                                            v-model="clauseQueryParamPro.clauseTextLike"
                                            prefix-icon="el-icon-search"
                                            :placeholder="MenuName == '制度解读类' ? '请输入制度条款' : '请输入条款原文'"
                                            style="margin-right: 10px; width: 230px"
                                            @input="clauseTextLikeQuery"
                                            v-if="tabPaneType == 'Product'"
                                        />
                                        <el-button
                                            @click="clauseAdvancedQuery"
                                            size="mini"
                                            v-if="['监管类', '合同类', '制度解读类'].includes(MenuName)"
                                        >
                                            高级查询
                                        </el-button>
                                        <el-button size="mini" @click="getIndexClauseListRefresh">刷新</el-button>
                                        <el-button size="mini" @click="downLoadGroupFileBtn">导出</el-button>
                                        <el-button size="mini" @click="layoutDialog = true" v-if="tabPaneType == 'File'">布局设置</el-button>
                                        <el-button size="mini" @click="layoutDialog = true" v-if="tabPaneType == 'Product'">布局设置</el-button>
                                    </div>
                                </div>
                                <div style="width: 98%; height: calc(100% - 100px); margin: 0 auto" class="index-clause">
                                    <vxe-table
                                        v-if="tabPaneType == 'File'"
                                        ref="upstreamTable"
                                        :key="tableKey"
                                        :data="indexClauseList"
                                        border
                                        stripe
                                        resizable
                                        :resizable-config="{ minWidth: '50' }"
                                        show-header-overflow="tooltip"
                                        size="mini"
                                        style="height: 100%"
                                        header-align="center"
                                        show-overflow
                                        @checkbox-change="clauseChangeEvent"
                                        @checkbox-all="clauseChangeEvent"
                                        @cell-click="handleRow"
                                        :cell-style="cellStyle"
                                        auto-resize
                                    >
                                        <vxe-column type="checkbox" width="50" fixed="left" align="center"></vxe-column>
                                        <vxe-column
                                            v-for="item in showFieldList"
                                            :key="item.clauseNo"
                                            :field="item.id"
                                            :fixed="item.fixed"
                                            :title="item.content"
                                            :sortable="item.sortable"
                                            :min-width="item.minWidth || 120"
                                            :filters="item.filters"
                                            :filter-method="filterHandler"
                                            :show-overflow-tooltip="true"
                                        >
                                            <template slot-scope="scope">
                                                <span v-if="['clauseCode'].includes(item.id)">{{ scope.row.clauseCode }}</span>
                                                <span v-else-if="['clauseStatus'].includes(item.id)">
                                                    <span v-if="scope.row.clauseStatus == '1'">
                                                        <span class="status-style status-style-blue"></span>
                                                        启用
                                                    </span>
                                                    <span v-else-if="scope.row.clauseStatus == '0'">
                                                        <span class="status-style status-style-red"></span>
                                                        停用
                                                    </span>
                                                </span>
                                                <span v-else-if="['clauseType'].includes(item.id)">
                                                    {{ clauseTypeEnum[scope.row.clauseType] || '--' }}
                                                </span>
                                                <span v-else-if="['passiveTransfinite'].includes(item.id)">{{
                                                    scope.row.passiveTransfinite == '1' ? '是' : '否'
                                                }}</span>
                                                <span v-else-if="['realTimeSupport'].includes(item.id)">{{
                                                    scope.row.realTimeSupport == 1
                                                        ? '支持'
                                                        : scope.row.realTimeSupport == 2
                                                        ? '部分支持'
                                                        : scope.row.realTimeSupport == 3
                                                        ? '不支持'
                                                        : '--'
                                                }}</span>
                                                <span v-else-if="['hdSupport'].includes(item.id)">{{
                                                    scope.row.hdSupport == 1
                                                        ? '支持'
                                                        : scope.row.hdSupport == 2
                                                        ? '部分支持'
                                                        : scope.row.hdSupport == 3
                                                        ? '不支持'
                                                        : '--'
                                                }}</span>
                                                <span v-else-if="['modifyDateTime'].includes(item.id)"
                                                    >{{ scope.row.modifyDateTime ? dateFormat(scope.row.modifyDateTime.substr(0, 8)) : '--' }}
                                                    {{ scope.row.modifyDateTime ? timeFormat(scope.row.modifyDateTime.substr(8, 14)) : '' }}</span
                                                >
                                                <span v-else-if="['createUserName'].includes(item.id)">
                                                    <span v-if="scope.row.modifyEvent == '1'">{{ scope.row.createUserName || '--' }}</span>
                                                    <span v-else>{{ scope.row.modifyUser || '--' }}</span>
                                                </span>
                                                <span v-else-if="['directoryCode'].includes(item.id)">{{
                                                    indexTypeList[scope.row.directoryCode] || '--'
                                                }}</span>
                                                <span v-else-if="['pcProductType2'].includes(item.id)">{{
                                                    getPcProductType2(scope.row[item.id]) || '--'
                                                }}</span>
                                                <span v-else-if="['specialProducts'].includes(item.id)">{{
                                                    scope.row[item.id].join(',') || '--'
                                                }}</span>
                                                <span v-else>{{ scope.row[item.id] || '--' }}</span>
                                            </template>
                                        </vxe-column>
                                        <vxe-column title="操作" width="180" fixed="right" align="center">
                                            <template slot-scope="scope">
                                                <el-link
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @click="openhandleClauseDialog(scope.row, MenuName + '修改')"
                                                >
                                                    修改
                                                </el-link>
                                                <el-link
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @click="openhandleClauseDialog(scope.row, MenuName + '查看')"
                                                >
                                                    查看
                                                </el-link>
                                                <el-link
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @click="delClauseDialog(scope.row, '单个删除')"
                                                >
                                                    删除
                                                </el-link>
                                            </template>
                                        </vxe-column>
                                    </vxe-table>
                                    <div class="block" v-if="tabPaneType == 'File'">
                                        <risk-pagination :paging="groupPage" @page-change="pageRet"></risk-pagination>
                                    </div>
                                    <vxe-table
                                        ref="upstreamTable"
                                        :key="tableKeyProduct"
                                        :data="indexClauseProductList"
                                        border
                                        stripe
                                        resizable
                                        :resizable-config="{ minWidth: '50' }"
                                        show-header-overflow="tooltip"
                                        size="mini"
                                        style="height: 100%"
                                        :max-height="MenuName == '制度解读类' ? '250px' : '250px'"
                                        header-align="center"
                                        show-overflow
                                        @checkbox-change="clauseChangeEventProduct"
                                        @checkbox-all="clauseChangeEventProduct"
                                        @cell-click="handleRowProduct"
                                        :cell-style="cellProductStyle"
                                        auto-resize
                                        v-if="tabPaneType == 'Product'"
                                    >
                                        <vxe-column type="checkbox" width="50" fixed="left" align="center"></vxe-column>
                                        <vxe-column
                                            v-for="item in showFieldListProduct"
                                            :key="item.clauseNo"
                                            :field="item.id"
                                            :fixed="item.fixed"
                                            :title="item.content"
                                            :sortable="item.sortable"
                                            :min-width="item.minWidth || 120"
                                            :filters="item.filters"
                                            :filter-method="filterHandler"
                                            :show-overflow-tooltip="true"
                                        >
                                            <template slot-scope="scope">
                                                <span v-if="['clauseCode'].includes(item.id)">{{ scope.row.clauseCode }}</span>
                                                <span v-else-if="['clauseStatus'].includes(item.id)">
                                                    <span style="color: green" v-if="scope.row.clauseStatus == '1'">启用</span>
                                                    <span style="color: red" v-else-if="scope.row.clauseStatus == '0'">停用</span>
                                                </span>
                                                <span v-else-if="['clauseType'].includes(item.id)">
                                                    {{ clauseTypeEnum[scope.row.clauseType] || '--' }}
                                                </span>
                                                <span v-else-if="['passiveTransfinite'].includes(item.id)">{{
                                                    scope.row.passiveTransfinite == '1' ? '是' : '否'
                                                }}</span>
                                                <span v-else-if="['realTimeSupport'].includes(item.id)">{{
                                                    scope.row.realTimeSupport == 1
                                                        ? '支持'
                                                        : scope.row.realTimeSupport == 2
                                                        ? '部分支持'
                                                        : scope.row.realTimeSupport == 3
                                                        ? '不支持'
                                                        : '--'
                                                }}</span>
                                                <span v-else-if="['hdSupport'].includes(item.id)">{{
                                                    scope.row.hdSupport == 1
                                                        ? '支持'
                                                        : scope.row.hdSupport == 2
                                                        ? '部分支持'
                                                        : scope.row.hdSupport == 3
                                                        ? '不支持'
                                                        : '--'
                                                }}</span>
                                                <span v-else-if="['modifyDateTime'].includes(item.id)">{{
                                                    timeFormat(scope.row.modifyDateTime) || '--'
                                                }}</span>
                                                <span v-else-if="['pcProductType', 'ptProductType1'].includes(item.id)">{{
                                                    scope.row[item.id] || '--'
                                                }}</span>
                                                <span v-else-if="['pcProductType2'].includes(item.id)">{{
                                                    getPcProductType2(scope.row[item.id]) || '--'
                                                }}</span>
                                                <span v-else-if="['specialProducts'].includes(item.id)">{{
                                                    scope.row[item.id].join(',') || '--'
                                                }}</span>
                                                <span v-else-if="['createUserName'].includes(item.id)">
                                                    <span v-if="scope.row.modifyEvent == '1'">{{ scope.row.createUserName || '--' }}</span>
                                                    <span v-else>{{ scope.row.modifyUser || '--' }}</span>
                                                </span>
                                                <span v-else-if="['directoryCode'].includes(item.id)">{{
                                                    indexTypeList[scope.row.directoryCode] || '--'
                                                }}</span>
                                                <span v-else>{{ scope.row[item.id] || '--' }}</span>
                                            </template>
                                        </vxe-column>
                                        <vxe-column title="操作" width="180" fixed="right">
                                            <template slot-scope="scope">
                                                <RiskIconButton
                                                    type="primary"
                                                    icon="el-icon-edit"
                                                    topTitle="修改"
                                                    v-authCode="B_0188"
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @on-click="openhandleClauseDialogProduct(scope.row, '修改')"
                                                ></RiskIconButton>
                                                <RiskIconButton
                                                    type="danger"
                                                    icon="el-icon-delete"
                                                    topTitle="删除"
                                                    v-authCode="B_0191"
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @on-click="delClauseDialog(scope.row, '单个删除')"
                                                ></RiskIconButton>
                                                <RiskIconButton
                                                    type="primary"
                                                    icon="el-icon-view"
                                                    topTitle="查看"
                                                    v-authCode="B_0191"
                                                    :disabled="scope.row.modifyEvent ? true : false"
                                                    @on-click="openhandleClauseDialogProduct(scope.row, '查看')"
                                                ></RiskIconButton>
                                            </template>
                                        </vxe-column>
                                    </vxe-table>
                                    <div class="block" v-if="tabPaneType == 'Product'">
                                        <risk-pagination :paging="groupPageProduct" @page-change="pageRetProduct"></risk-pagination>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <el-divider></el-divider>
                        <!-- 合规规则 -->
                        <div class="content-bottom" v-if="['监管类', '合同类', '制度解读类'].includes(MenuName)">
                            <ComplianceRules
                                :treeNodeData="treeNodeData"
                                :indexClauseRelation="indexClauseRelation"
                                :indexClauseRelationProduct="indexClauseRelationProduct"
                                :clauseCodesList="clauseCodesList"
                                :indexClauseList="indexClauseList"
                                :checkItemIs="checkItemIs"
                                :tabPaneType="tabPaneType"
                                @emitRefreshChild="emitRefreshChild"
                            ></ComplianceRules>
                        </div>
                    </el-tab-pane>
                </el-tabs>
            </div>
        </template>
        <!-- 子组件类弹窗 -->
        <template>
            <!-- 来源文件管理弹窗 -->
            <SourceDocumentDialog
                :MenuName="MenuNameCopy"
                :addSourceDialog="addSourceDialog"
                :indexItem="indexItem"
                :indexClauseList="indexClauseList"
                @emitSource="emitSource"
                @emitHandleVaild="emitHandleVaild"
                @emitAddSourceDialog="emitAddSourceDialog"
                @emitAddFileSourceCategoryNode="getFileSourceCategoryData"
            ></SourceDocumentDialog>
            <!-- 合规条款新增/修改/查看弹窗 -->
            <TreatyArticleDialog
                :addTreatyDialog="addTreatyDialog"
                :sourceSettteingType="sourceSettteingType"
                :treeNodeData="treeNodeData"
                :clauseCodeItem="clauseCodeItem"
                :clauseCodes="clauseCodes"
                @emitTreatyArticle="emitTreatyArticle"
            ></TreatyArticleDialog>
            <!-- 系列条款弹窗 -->
            <SerialClauseDialog
                :serialClauseDialog="serialClauseDialog"
                :treeNodeData="treeNodeData"
                @emitCopyProduct="emitCopyProduct"
                @emitSerialClauseDialog="emitSerialClauseDialog"
            ></SerialClauseDialog>
            <!-- 条款高级查询 -->
            <ClauseQueryDialog
                :tabPaneType="tabPaneType"
                :complianceType="MenuName"
                :clauseQueryDialog="clauseQueryDialog"
                :treeNodeData="treeNodeData"
                :clauseQueryParam="clauseQueryParam"
                :directoryCodeSelect="directoryCodeSelect"
                @emitClauseQuery="emitClauseQuery"
                v-if="tabPaneType == 'File'"
            ></ClauseQueryDialog>
            <ClauseQueryDialog
                :tabPaneType="tabPaneType"
                :complianceType="MenuName"
                :allProduct="allProduct[0]"
                :clauseQueryDialog="clauseQueryDialog"
                :treeNodeDataProduct="treeNodeDataProduct"
                :clauseQueryParamPro="clauseQueryParamPro"
                :directoryCodeSelect="directoryCodeSelect"
                @emitClauseQueryProduct="emitClauseQueryProduct"
                v-if="tabPaneType == 'Product'"
            ></ClauseQueryDialog>
            <!-- 条目记录弹窗 -->
            <EntryRecordDialog
                :entryRecordDialog="entryRecordDialog"
                :entryRecordItem="entryRecordItem"
                @emitEntryRecordDialog="emitEntryRecordDialog"
            ></EntryRecordDialog>
            <!-- 树节点新增、编辑 -->
            <CategoryNodeDialog
                :categoryNodeDialog="categoryNodeDialog"
                :categoryNodeType="categoryNodeType"
                :indexItem="indexItem"
                @emitCategoryNodeDialog="emitCategoryNodeDialog"
            ></CategoryNodeDialog>
            <!-- 导入 -->
            <ImportFileDialog :treeNodeData="treeNodeData" :importFileDialog="importFileDialog" @emitImportFile="emitImportFile"></ImportFileDialog>
            <!-- 删除确认窗口 -->
            <DeletionConfirmationDialog
                title="警告"
                :delConfirmationDialog="delConfirmationDialog"
                @emitDialogVisible="emitDialogVisible"
                @emitHandleBtn="emitHandleBtn"
            >
                <div slot="content1">{{ delContent }}</div>
            </DeletionConfirmationDialog>
            <!-- 布局设置 -->
            <RiskTableLayout
                title="页面布局"
                :visible.sync="layoutDialog"
                :field-list="tableColumns"
                :selected-field-list="selectedFieldList"
                :fixed-field-list="fixedFieldList"
                :table-name="tableName"
                @on-submit="onSubmit"
                v-if="tabPaneType == 'File'"
            />
            <RiskTableLayout
                title="页面布局"
                :visible.sync="layoutDialog"
                :field-list="tableColumns4"
                :selected-field-list="selectedFieldListProduct"
                :fixed-field-list="fixedFieldListProduct"
                table-name="ENTRY_STANDARD_LIBRARY_CLAUSE4"
                @on-submit="onSubmitProduct"
                v-if="tabPaneType == 'Product'"
            />
        </template>
    </div>
</template>
<script lang="ts">
import { Component, Vue, Watch, Prop } from 'vue-property-decorator';
import EntryLeftModule from './entry-left-module.vue';
import RiskIconButton from '@/common/components/risk-icon-button.vue';
import SourceDocumentDialog from './components/source-document-dialog.vue';
import HeaderTitle from './commom/header-title.vue';
import RiskPagination from '@/common/components/risk-pagination.vue';
import TreatyArticleDialog from './components/treaty-article-dialog.vue';
import SerialClauseDialog from './components/serial-clause-dialog.vue';
import ClauseQueryDialog from './components/clause-query-dialog.vue';
import RiskTableLayout from '@/common/components/risk-table-layout.vue';
import EntryRecordDialog from './components/entry-record-dialog.vue';
import CategoryNodeDialog from './components/category-node-dialog.vue';
import ComplianceRules from './compliance-rules.vue';
import DeletionConfirmationDialog from './commom/deletion-confirmation-dialog.vue';
import ImportFileDialog from './components/import-file-dialog.vue';
import { dateFormat, timeFormat } from '@/utils/tools';
import { getTableLayout } from '@/common/api/commonApi';
import Invest from '@/common/dict/invest';
import { downLoadFile } from '@/utils/request';
import Source from './components/source.vue';
import { VueObject } from '@/common/vo';

export interface pages {
    total?: number;
    pageSize?: number;
    currentPage?: number;
}

@Component({
    name: 'ComplianceClause',
    components: {
        EntryLeftModule,
        RiskIconButton,
        SourceDocumentDialog,
        HeaderTitle,
        RiskPagination,
        TreatyArticleDialog,
        SerialClauseDialog,
        ClauseQueryDialog,
        RiskTableLayout,
        EntryRecordDialog,
        CategoryNodeDialog,
        ComplianceRules,
        DeletionConfirmationDialog,
        ImportFileDialog,
        Source,
    },
})
export default class ComplianceClause extends Vue {
    // @Prop() MenuName;
    Invest: any = new Invest();
    timeFormat = timeFormat;
    dateFormat = dateFormat;
    fileSourceCategoryData = [
        { id: '0', label: '监管类', level: '1', indexType: '1', children: [] },
        { id: '1', label: '合同类', level: '1', indexType: '2', children: [] },
        { id: '2', label: '公司制度解读类', level: '1', indexType: '3', children: [] },
    ]; // 文件来源分类数据
    // fileSourceCategoryData = [
    //             {
    //                 id: '0',
    //                 label: '监管类',
    //                 level: '1',
    //                 indexType: '1',
    //                 children: [{
    //                     indexDirectoryCode: '436',
    //                     indexName: '基本业务',
    //                     indexType: '1',
    //                     level: '2',
    //                     parent: '0',
    //                     children: [
    //                         {
    //                             articleCode: '90412',
    //                             articleName: '中国证券2222呃3而大师傅士大夫地方我俄方微风威风',
    //                             finish: '0',
    //                             flag: false,
    //                             indexDirectoryCode: '436',
    //                             indexType: '1',
    //                             level: '3',
    //                         }
    //                     ]
    //                 }],
    //             },
    //             {
    //                 id: '1',
    //                 label: '合同类',
    //                 level: '1',
    //                 indexType: '2',
    //                 children: [
    //                     {
    //                         id: '5',
    //                         label: '运作中(公募)',
    //                         level: '3',
    //                         indexType: '2',
    //                         liquidation: '1',
    //                         children: [
    //                         {
    //                             articleCode: '90412',
    //                             articleName: '中国证券2222呃3而大师傅士大夫地方我俄方微风威风',
    //                             finish: '0',
    //                             flag: false,
    //                             indexDirectoryCode: '436',
    //                             indexType: '2',
    //                             level: '4',
    //                         }
    //                     ] },
    //                     { id: '6', label: '运作中(私募单一)', level: '3', indexType: '2', liquidation: '1', children: [] },
    //                     { id: '7', label: '运作中(私募集合)', level: '3', indexType: '2', liquidation: '1', children: [] },
    //                     { id: '8', label: '已清盘(公募)', level: '3', indexType: '2', liquidation: '2', children: [] },
    //                     { id: '9', label: '已清盘(私募单一)', level: '3', indexType: '2', liquidation: '2', children: [] },
    //                     { id: '10', label: '已清盘(私募集合)', level: '3', indexType: '2', liquidation: '2', children: [] },
    //                 ],
    //             },
    //             {
    //                 id: '2',
    //                 label: '公司制度解读类',
    //                 level: '1',
    //                 indexType: '3',
    //                 children: [],
    //             },
    //         ]
    productDataSource = [
        { id: '5', label: '运作中(公募)', level: '3', indexType: '2', liquidation: '1', children: [] },
        { id: '6', label: '运作中(私募单一)', level: '3', indexType: '2', liquidation: '1', children: [] },
        { id: '7', label: '运作中(私募集合)', level: '3', indexType: '2', liquidation: '1', children: [] },
        { id: '8', label: '已清盘(公募)', level: '3', indexType: '2', liquidation: '2', children: [] },
        { id: '9', label: '已清盘(私募单一)', level: '3', indexType: '2', liquidation: '2', children: [] },
        { id: '10', label: '已清盘(私募集合)', level: '3', indexType: '2', liquidation: '2', children: [] },
    ];
    indexTypeList = {
        '5': '公募',
        '6': '私募单一',
        '7': '私募集合',
        '8': '公募',
        '9': '私募单一',
        '10': '私募集合',
    };

    clauseTypeEnum = {
        '0': '投资范围',
        '1': '投资限制',
        '2': '关联交易',
        '3': '其他',
        '4': '监管条款',
        '5': '预警止损线',
    };

    productSourceCategoryData = []; // 产品来源分类数据
    indexClauseList = []; // 条款列表数据
    indexClauseProductList = []; // 产品维度 -- 条款列表数据
    addSourceDialog: boolean = false; // 新增来源文件弹窗
    addTreatyDialog: boolean = false; // 新增合规条款弹窗
    clauseQueryDialog: boolean = false; // 条款高级查询弹窗
    entryRecordDialog: boolean = false; // 条目记录弹窗
    categoryNodeDialog: boolean = false;
    serialClauseDialog: boolean = false; // 系列条款弹窗
    sourceSettteingType: string = ''; // 条款设置弹窗类型
    delConfirmationDialog: boolean = false;
    importFileDialog: boolean = false; // 合规条款导入弹窗
    delContent: string = '是否删除所选记录？';
    currentNodeFilekey: string = '0'; // 当前点击节点
    currentNodeProductkey: string = '5'; // 当前点击节点-- 产品
    allProduct = []; // 条款适用产品
    treeNodeData = {
        id: '0',
        label: '监管类',
        level: '1',
        indexType: '1',
        children: [],
    }; // 当前选择树节点数据
    treeNodeDataProduct = { id: '5', label: '运作中(公募)', level: '3', indexType: '2', liquidation: '1', children: [] }; // 当前选择树节点数据
    clauseCodeItem = {
        clauseCode: '',
        indexSourceCode: '',
        articleCode: '',
    }; // 条款操作行clauseCode
    clauseCodes = []; // 条款多选code
    clauseCodesList = []; // 条款多选全部数据
    clauseCodesProduct = []; // 条款多选code---产品维度
    clauseCodesListProduct = []; // 条款多选全部数据 -- 产品维度
    entryRecordItem = ''; // 条目操作记录节点
    indexItem = ''; // 指标操作行数据
    categoryNodeType = ''; // 节点新增、编辑
    clauseRow: string = ''; // 条款table行code
    delType = {
        type: '',
        content: '',
    }; // 删除类型
    clauseQueryParam = {
        // 列表查询条件
        articleCode: '',
        articleCode1: '',
        belongFund: '',
        clauseCode: '',
        clauseNo: '',
        clauseSourceCode: '',
        clauseStatus: '',
        clauseText: '',
        clauseTextLike: '',
        clauseType: '',
        hdSupport: '',
        paging: {
            currentPage: 1,
            pageSize: 50,
        },
        passiveTransfinite: '',
        realTimeSupport: '',
        status: '',
        suitableFund: '',
        versionNumber: '',
        versionNumbers: [],
        versionValid: '',
        indexType: '',
        indexDirectoryCode: '',
        liquidation: '',
        directoryCode: '',
        directoryCode1: '',
        sourceName: '',
        pcProductType: [],
        ptProductType1: [],
        directoryCode1Str: '',
        hsSupport: '',
        shSupport: '',
        taskType: '',
        specialProductsList: [],
    };
    clauseQueryParamPro = {
        // 列表查询条件
        articleCode: '',
        articleCode1: '',
        belongFund: '',
        clauseCode: '',
        clauseNo: '',
        clauseSourceCode: '',
        clauseStatus: '',
        clauseText: '',
        clauseTextLike: '',
        clauseType: '',
        hdSupport: '',
        paging: {
            currentPage: 1,
            pageSize: 50,
        },
        passiveTransfinite: '',
        realTimeSupport: '',
        status: '',
        suitableFund: '',
        versionNumber: '',
        versionNumbers: [],
        versionValid: '',
        indexType: '',
        indexDirectoryCode: '',
        fundDirectoryCode: '',
        liquidation: '',
        directoryCode: '',
        directoryCode1Str: '',
        sourceName: '',
        pcProductType: [],
        ptProductType1: [],
        productType: '',
        productTypes: '',
    };
    indexClauseRelation = { clauseCode: '' };
    indexClauseRelationProduct = { clauseCode: '' };
    headerTitle = '监管类';
    headerTitle2 = '运作中';
    tableName = 'ENTRY_STANDARD_LIBRARY_CLAUSE1';
    // 监管类--全部表格列
    tableColumns1: any[] = [
        { content: '序号', id: 'clauseCode', sortable: false, fixed: 'left', minWidth: 80 },
        { content: '版本号', id: 'versionNumber', sortable: false, minWidth: 120 },
        { content: '来源名称', id: 'sourceName', sortable: false, minWidth: 200 },
        { content: '条款原文', id: 'clauseText', sortable: false, minWidth: 200 },
        { content: '执行标准', id: 'executiveStandArd', sortable: false, minWidth: 120 },
        { content: '托管行意见', id: 'depositOpinions', sortable: false, minWidth: 120 },
        { content: '行业调研', id: 'industryResearch', sortable: false, minWidth: 120 },
        { content: '条款号', id: 'clauseNo', sortable: false, minWidth: 100 },
        { content: '条款状态', id: 'clauseStatus', sortable: false, minWidth: 100 },
        { content: '是否可被动超限', id: 'passiveTransfinite', sortable: false, minWidth: 180 },
        { content: '公募产品', id: 'pcProductTypeStr', sortable: false, minWidth: 150 },
        { content: '公募产品2', id: 'pcProductType2', sortable: false, minWidth: 150 },
        { content: '私募产品', id: 'ptProductTypeStr', sortable: false, minWidth: 150 },
        { content: '特殊产品', id: 'specialProducts', sortable: false, minWidth: 150 },
        { content: '恒生交易系统支持情况', id: 'realTimeSupport', sortable: false, minWidth: 190 },
        { content: '事后系统支持情况', id: 'hdSupport', sortable: false, minWidth: 190 },
        { content: '修改时间', id: 'modifyDateTime', sortable: false, minWidth: 150 },
        { content: '修改人', id: 'modifyUser', sortable: false, minWidth: 120 },
    ];
    // 合同类--全部表格列
    tableColumns2: any[] = [
        { content: '序号', id: 'clauseCode', sortable: false, fixed: 'left', minWidth: 80 },
        { content: '产品类型', id: 'directoryCode', sortable: false, minWidth: 100 },
        { content: '产品名称', id: 'sourceName', sortable: false, minWidth: 150 },
        { content: '合同名称', id: 'versionNumber', sortable: false, minWidth: 150 },
        { content: '条款类型', id: 'clauseType', sortable: false, minWidth: 120 },
        { content: '条款号', id: 'clauseNo', sortable: false, minWidth: 100 },
        { content: '条款原文', id: 'clauseText', sortable: false, minWidth: 200 },
        { content: '执行标准', id: 'executiveStandArd', sortable: false, minWidth: 120 },
        { content: '托管行意见', id: 'depositOpinions', sortable: false, minWidth: 120 },
        { content: '条款状态', id: 'clauseStatus', sortable: false, minWidth: 100 },
        { content: '是否可被动超限', id: 'passiveTransfinite', sortable: false, minWidth: 180 },
        { content: '恒生交易系统支持情况', id: 'realTimeSupport', sortable: false, minWidth: 190 },
        { content: '事后系统支持情况', id: 'hdSupport', sortable: false, minWidth: 190 },
        { content: '修改时间', id: 'modifyDateTime', sortable: false, minWidth: 150 },
        { content: '修改人', id: 'modifyUser', sortable: false, minWidth: 120 },
    ];
    // 公司制度解读类--全部表格列
    tableColumns3: any[] = [
        { content: '序号', id: 'clauseCode', sortable: false, fixed: 'left', minWidth: 80 },
        { content: '版本号', id: 'versionNumber', sortable: false, minWidth: 120 },
        { content: '来源名称', id: 'sourceName', sortable: false, minWidth: 150 },
        { content: '制度条款', id: 'institutionalProvisions', sortable: false, minWidth: 200 },
        { content: '条款解读', id: 'executiveStandArd', sortable: false, minWidth: 200 },
        // { content: '托管行意见', id: 'depositOpinions', sortable: false, minWidth: 120 },
        // { content: '行业调研', id: 'industryResearch', sortable: false, minWidth: 120 },
        { content: '条款号', id: 'clauseNo', sortable: false, minWidth: 100 },
        { content: '条款状态', id: 'clauseStatus', sortable: false, minWidth: 100 },
        { content: '是否可被动超限', id: 'passiveTransfinite', sortable: false, minWidth: 180 },
        { content: '公募产品', id: 'pcProductTypeStr', sortable: false, minWidth: 150 },
        { content: '公募产品2', id: 'pcProductType2', sortable: false, minWidth: 150 },
        { content: '私募产品', id: 'ptProductTypeStr', sortable: false, minWidth: 150 },
        { content: '特殊产品', id: 'specialProducts', sortable: false, minWidth: 150 },
        { content: '恒生交易系统支持情况', id: 'realTimeSupport', sortable: false, minWidth: 190 },
        { content: '事后系统支持情况', id: 'hdSupport', sortable: false, minWidth: 190 },
        { content: '修改时间', id: 'modifyDateTime', sortable: false, minWidth: 150 },
        { content: '修改人', id: 'modifyUser', sortable: false, minWidth: 120 },
    ];
    // 产品维度--全部表格列
    tableColumns4: any[] = [
        { content: '序号', id: 'clauseCode', sortable: false, fixed: 'left', minWidth: 80 },
        { content: '条款原文', id: 'clauseText', sortable: false, minWidth: 200 },
        { content: '执行标准', id: 'executiveStandArd', sortable: false, minWidth: 120 },
        { content: '托管行意见', id: 'depositOpinions', sortable: false, minWidth: 120 },
        { content: '行业调研', id: 'industryResearch', sortable: false, minWidth: 120 },
        { content: '制度条款', id: 'institutionalProvisions', sortable: false, minWidth: 200 },
        { content: '条款解读', id: 'clauseInterpret', sortable: false, minWidth: 200 },
        { content: '条款状态', id: 'clauseStatus', sortable: false, minWidth: 100 },
        { content: '是否可被动超限', id: 'passiveTransfinite', sortable: false, minWidth: 180 },
        { content: '公募产品', id: 'pcProductTypeStr', sortable: false, minWidth: 150 },
        { content: '公募产品2', id: 'pcProductType2', sortable: false, minWidth: 150 },
        { content: '私募产品', id: 'ptProductTypeStr', sortable: false, minWidth: 150 },
        { content: '特殊产品', id: 'specialProducts', sortable: false, minWidth: 150 },
        { content: '恒生交易系统支持情况', id: 'realTimeSupport', sortable: false, minWidth: 190 },
        { content: '事后系统支持情况', id: 'hdSupport', sortable: false, minWidth: 190 },
        { content: '来源名称', id: 'sourceName', sortable: false, minWidth: 150 },
        { content: '版本号', id: 'versionNumber', sortable: true, minWidth: 100 },
        { content: '条款号', id: 'clauseNo', sortable: false, minWidth: 100 },
        { content: '产品类型', id: 'directoryCode', sortable: false, minWidth: 120 },
        { content: '产品名称', id: 'productName', sortable: false, minWidth: 150 },
        { content: '合同名称', id: 'contractName', sortable: true, minWidth: 200 },
        { content: '条款类型', id: 'clauseType', sortable: false, minWidth: 120 },
        { content: '修改时间', id: 'modifyDateTime', sortable: false, minWidth: 150 },
        { content: '修改人', id: 'modifyUser', sortable: false, minWidth: 120 },
    ];
    tableColumns = [];
    private groupPage: pages = {
        currentPage: 1,
        pageSize: 50,
        total: 0,
    };
    private groupPageProduct: pages = {
        currentPage: 1,
        pageSize: 50,
        total: 0,
    };
    timeout = null; // 防抖
    layoutDialog: boolean = false; // 布局显示值
    showFieldList: any[] = []; // 要显示的表格列
    // 已选择字段列表
    selectedFieldList: any[] = [];
    fixedFieldList: any[] = [
        { content: '序号', id: 'clauseCode', sortable: true, minWidth: 80 },
        // { content: '条款原文', id: 'clauseText', sortable: false },
    ];
    showFieldListProduct: any[] = []; // 要显示的表格列
    // 已选择字段列表--产品
    selectedFieldListProduct: any[] = [];
    fixedFieldListProduct: any[] = [
        { content: '序号', id: 'clauseCode', sortable: true, minWidth: 80 },
        // { content: '条款原文', id: 'clauseText', sortable: false },
    ];
    iconDom: any = null;
    tableKey: number = 0;
    tableKeyProduct: number = 0;
    calcLoading: boolean = false;
    checkItemIs: boolean = false; // 是否存在为复核条款
    tabPaneType: string = 'File'; // 文件File、产品Product
    MenuName: string = '监管类'; // 监管类，合同类，制度解读类
    directoryCodeSelect = []; // 产品维度-高级查询-产品类型下拉框
    // entryTypeArr: any[] = []; // 风险类型
    refreshKey = 0;

    private state: boolean = true;

    private lastMenuCode = ''; // 记录上一次点击的左侧菜单对比

    activeTab: string = 'source';

    treeExpandKeys: string[] = ['0'];
    treeExpandKeys2: string[] = ['0'];

    taskType2: boolean = false;
    taskType3: boolean = false;
    PCPRODUCTTYPE2 = {
        '5': '指数基金',
        '6': '现金管理',
    };

    goClauseCode: string = ''; // 弃用
    goCurrentNodeFilekey: string = ''; // 弃用
    goFirst: boolean = false; // 弃用

    // 隐藏树形结构
    toggleBtm() {
        this.state = !this.state;
    }

    created() {
        console.log('进入created');
        if (sessionStorage.getItem('jumpParam-defaultFundCode')) {
            this.currentNodeFilekey = sessionStorage.getItem('jumpParam-defaultFundCode');
        }
        if (sessionStorage.getItem('jumpParam-defaultActiveTab')) {
            this.activeTab = sessionStorage.getItem('jumpParam-defaultActiveTab');
            setTimeout(() => {
                sessionStorage.removeItem('jumpParam-defaultActiveTab');
            }, 1000);
        }

        this.clauseQueryParam.indexType = '1';
        this.clauseQueryParam.indexDirectoryCode = '';
        this.clauseQueryParam.directoryCode = '';
        this.clauseQueryParam.articleCode = '';
        this.clauseQueryParam.liquidation = '';

        this.clauseQueryParamPro.liquidation = '1';
        this.clauseQueryParamPro.indexType = '2';
        this.clauseQueryParamPro.pcProductType = ['1', '2', '3', '4'];
        // this.clauseQueryParamPro.ptProductType1 = ['A2', 'B1'];
        this.clauseQueryParamPro.productType = '1';
        this.clauseQueryParamPro.directoryCode = '';
        this.clauseQueryParamPro.articleCode = '';
        this.clauseQueryParamPro.fundDirectoryCode = '5';
        // 查询来源目录信息
        this.getFileSourceCategoryData();
        // 产品维度
        this.getFileSourceCategoryProData();
        this.tableColumns = this.tableColumns1;
    }
    mounted() {
        console.log('进入mounted');
        this.queryLayout();
        this.queryLayoutProduct();
    }
    get addDisabled() {
        if (this.treeNodeData.level == '3' && (this.treeNodeData.indexType == '1' || this.treeNodeData.indexType == '3')) {
            return false;
        } else if (this.treeNodeData.level == '4' && this.treeNodeData.indexType == '2') {
            return false;
        } else {
            return true;
        }
    }

    get tabLabel1() {
        const enums = { '1': '法律法规', '2': '产品合同', '3': '来源' };
        return enums[this.treeNodeData.indexType];
    }

    get tabLabel2() {
        if (this.tabPaneType === 'Product') {
            return '合同条款';
        }
        const enums = { '1': '监管条款', '2': '合同条款', '3': '合规条款' };
        return enums[this.treeNodeData.indexType];
    }

    @Watch('treeNodeData.indexType', { immediate: true, deep: true })
    watchIndexType(newVal, oldVal) {
        if (newVal != oldVal) {
            this.queryLayout();
        }
    }
    // 当前选择树节点数据--文件
    handleNodeClick(param1, param2) {
        this.indexClauseRelation = { clauseCode: '' };
        if (param1.id != this.lastMenuCode) {
            // 点击左侧需要清空高级查询里面之前录入过的查询条件
            this.resetClauseQueryParam();
            this.resetClauseQueryParamPro();
        }
        this.lastMenuCode = param1.id;
        this.treeNodeData = param1;
        this.currentNodeFilekey = String(param1.id);
        if (param1.indexType == 1) {
            this.tableKey += 1;
            this.tableColumns = this.tableColumns1;
            this.headerTitle = '监管类';
        } else if (param1.indexType == 2) {
            this.tableKey += 1;
            this.tableColumns = this.tableColumns2;
            this.headerTitle = '合同类';
        } else if (param1.indexType == 3) {
            this.tableKey += 1;
            this.tableColumns = this.tableColumns3;
            this.headerTitle = '公司制度解读类';
        }
        // 未稳定不建议封装
        if (['1'].includes(param1.indexType) && param1.level == '1') {
            this.clauseQueryParam.indexType = '1';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '';
        } else if (['2'].includes(param1.indexType) && param1.level == '1') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '';
        } else if (['3'].includes(param1.indexType) && param1.level == '1') {
            this.clauseQueryParam.indexType = '3';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '';
        } else if (['1'].includes(param1.indexType) && param1.level == '2') {
            this.clauseQueryParam.indexType = '1';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '';
        } else if (['3'].includes(param1.indexType) && param1.level == '2') {
            this.clauseQueryParam.indexType = '3';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '';
        } else if (['2'].includes(param1.indexType) && param1.level == '2' && param1.id == '3') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '1';
        } else if (['2'].includes(param1.indexType) && param1.level == '2' && param1.id == '4') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '2';
        } else if (['1'].includes(param1.indexType) && param1.level == '3') {
            this.clauseQueryParam.indexType = '1';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = param1.id;
            this.clauseQueryParam.liquidation = '';
        } else if (['3'].includes(param1.indexType) && param1.level == '3') {
            this.clauseQueryParam.indexType = '3';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = param1.id;
            this.clauseQueryParam.liquidation = '';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '5') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '1';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '6') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '1';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '7') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '1';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '8') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '2';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '9') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '2';
        } else if (['2'].includes(param1.indexType) && param1.level == '3' && param1.id == '10') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = param1.id;
            this.clauseQueryParam.articleCode = '';
            this.clauseQueryParam.liquidation = '2';
        } else if (['2'].includes(param1.indexType) && param1.level == '4') {
            this.clauseQueryParam.indexType = '2';
            this.clauseQueryParam.directoryCode = '';
            this.clauseQueryParam.articleCode = param1.id;
            this.clauseQueryParam.liquidation = param1.liquidation;
        }
        this.clauseQueryParam.clauseCode = '';
        if (param1.indexType == '2') {
            this.MenuName = '合同类';
        } else if (param1.indexType == '3') {
            this.MenuName = '制度解读类';
        } else if (param1.indexType == '1') {
            this.MenuName = '监管类';
        }
        this.checkItemIs = false;

        console.log('!!!~~~');
        if (sessionStorage.getItem('jumpParam-clauseCode')) {
            let clauseCode = JSON.parse(JSON.stringify(sessionStorage.getItem('jumpParam-clauseCode')));
            sessionStorage.removeItem('jumpParam-clauseCode');
            this.clauseQueryParam.clauseCode = clauseCode;
        }

        if (sessionStorage.getItem('jumpParam-defaultFundCode')) {
            sessionStorage.removeItem('jumpParam-defaultFundCode');
        }

        this.getIndexClauseList('');
    }
    // 当前选择树节点数据--产品
    handleNodeClickPro(param1, param2) {
        console.log('44');
        this.treeNodeDataProduct = param1;
        this.currentNodeProductkey = String(param1.id);
        this.clauseQueryParamPro.clauseCode = '';
        this.tableKeyProduct += 1;
        if (param1.liquidation == '1') {
            this.headerTitle2 = '运作中';
        } else if (param1.liquidation == '2') {
            this.headerTitle2 = '已清盘';
        }
        // 未稳定不建议封装
        if (['3'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = ['1', '2', '3', '4'];
            this.clauseQueryParamPro.ptProductType1 = ['A2', 'B1', 'A', 'B', 'C', 'D'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (['4'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = ['1', '2', '3', '4'];
            this.clauseQueryParamPro.ptProductType1 = ['A2', 'B1', 'A', 'B', 'C', 'D'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (param1.id == '5') {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = ['1', '2', '3', '4'];
            this.clauseQueryParamPro.ptProductType1 = [];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (['6'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = ['B1'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (['7'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = ['A2'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (param1.id == '8') {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = ['1', '2', '3', '4'];
            this.clauseQueryParamPro.ptProductType1 = [];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (['9'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = ['B1'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (['10'].includes(param1.id)) {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = ['A2'];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = '';
            this.clauseQueryParamPro.fundDirectoryCode = param1.id;
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = '';
        } else if (param1.level == 4 && param1.productTypes == '5') {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = param1.cmsfundType;
            this.clauseQueryParamPro.ptProductType1 = [];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType;
        } else if (param1.level == 4 && ['6'].includes(param1.productTypes)) {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = param1.cmsfundType;
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType + ',' + param1.cmsfundType2;
        } else if (param1.level == 4 && ['7'].includes(param1.productTypes)) {
            this.clauseQueryParamPro.liquidation = '1';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = param1.cmsfundType;
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType + ',' + param1.cmsfundType2;
        } else if (param1.level == 4 && param1.productTypes == '8') {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = param1.cmsfundType;
            this.clauseQueryParamPro.ptProductType1 = [];
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType;
        } else if (param1.level == 4 && ['9'].includes(param1.productTypes)) {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = param1.cmsfundType;
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType + ',' + param1.cmsfundType2;
        } else if (param1.level == 4 && ['10'].includes(param1.productTypes)) {
            this.clauseQueryParamPro.liquidation = '2';
            this.clauseQueryParamPro.pcProductType = [];
            this.clauseQueryParamPro.ptProductType1 = param1.cmsfundType;
            this.clauseQueryParamPro.productType = '1';
            this.clauseQueryParamPro.directoryCode = '';
            this.clauseQueryParamPro.articleCode = param1.id;
            this.clauseQueryParamPro.fundDirectoryCode = '';
            this.clauseQueryParamPro.indexType = '2';
            this.clauseQueryParamPro.productTypes = param1.cmsfundType + ',' + param1.cmsfundType2;
        }
        this.getIndexClauseListPro();
    }
    // 查询来源目录信息
    getFileSourceCategoryData() {
        this.$axios.post('/zhiguan/indexArticle/directory/query', { parentCode: '' }).then((res: any) => {
            this.fileSourceCategoryData = [
                {
                    id: '0',
                    label: '监管类',
                    level: '1',
                    indexType: '1',
                    children: [],
                },
                {
                    id: '1',
                    label: '合同类',
                    level: '1',
                    indexType: '2',
                    children: [
                        { id: '5', label: '运作中(公募)', level: '3', indexType: '2', liquidation: '1', children: [] },
                        { id: '6', label: '运作中(私募单一)', level: '3', indexType: '2', liquidation: '1', children: [] },
                        { id: '7', label: '运作中(私募集合)', level: '3', indexType: '2', liquidation: '1', children: [] },
                        { id: '8', label: '已清盘(公募)', level: '3', indexType: '2', liquidation: '2', children: [] },
                        { id: '9', label: '已清盘(私募单一)', level: '3', indexType: '2', liquidation: '2', children: [] },
                        { id: '10', label: '已清盘(私募集合)', level: '3', indexType: '2', liquidation: '2', children: [] },
                    ],
                },
                {
                    id: '2',
                    label: '公司制度解读类',
                    level: '1',
                    indexType: '3',
                    children: [],
                },
            ];

            res.forEach(item => {
                this.fileSourceCategoryData.forEach((item2, index2) => {
                    if (item2.id == item.parentCode) {
                        this.fileSourceCategoryData[index2].children.push({
                            id: item.indexDirectoryCode,
                            label: item.indexName,
                            parentCode: item.parentCode,
                            level: '2',
                            indexType: item.indexType,
                            children: item.children ? this.remould(item.children) : [],
                            finish: item.finish,
                            setupDate: item.setupDate,
                        });
                    }
                });
            });
            console.log('过滤ww', this.$refs['left-tree'], (this.$refs['left-tree'] as any).filterFileText);
            let filterText = (this.$refs['left-tree'] as any).filterFileText;
            (this.$refs['left-tree'] as any).filterFileText = '';
            (this.$refs['left-tree'] as any).$refs.treeFile.filter(filterText);
            this.getFileSourceCategoryProductData();
            this.getIndexClauseList('');
        });
    }
    // 产品目录
    getFileSourceCategoryProData() {
        this.$axios.post('/zhiguan/indexArticle/directory/product/query', { parentCode: '', productType: '1', indexType: '2' }).then((res: any) => {
            this.productDataSource = [
                { id: '5', label: '运作中(公募)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '6', label: '运作中(私募单一)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '7', label: '运作中(私募集合)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '8', label: '已清盘(公募)', level: '3', indexType: '2', liquidation: '2', children: [] },
                { id: '9', label: '已清盘(私募单一)', level: '3', indexType: '2', liquidation: '2', children: [] },
                { id: '10', label: '已清盘(私募集合)', level: '3', indexType: '2', liquidation: '2', children: [] },
            ];
            this.directoryCodeSelect = [];
            this.allProduct = [];

            this.allProduct.push(res);
            res.forEach(item => {
                this.directoryCodeSelect.push({ ...item });
                this.productDataSource.forEach((item2, index2) => {
                    if (item2.id == item.productTypes) {
                        this.productDataSource[index2].children.push({
                            id: item.indexDirectoryCode,
                            label: item.indexName,
                            parentCode: item.parentCode,
                            level: '4',
                            indexType: item.indexType,
                            productTypes: item.productTypes,
                            liquidation: item.liquidation,
                            cmsfundType: item.cmsfundType,
                            productCode: item.productCode,
                            cmsfundType2: item.cmsfundType2,
                            finish: item.finish,
                            setupdate: item.setupdate,
                        });
                    }
                });
                // this.productDataSource[0].children.sort(this.compare('finish', false));
            });

            this.getIndexClauseListPro();
        });
    }
    remould(children) {
        let arr = [];
        children.forEach(item => {
            arr.push({
                id: item.articleCode,
                label: item.articleName,
                parentCode: item.indexDirectoryCode,
                level: '3',
                indexType: item.indexType,
                indexDirectoryCode: item.level == 2 && ['1', '3'].includes(item.indexType) ? item.indexDirectoryCode : '',
                articleCode: item.level == 2 && ['1', '3'].includes(item.indexType) ? item.articleCode : '',
            });
        });
        return arr;
    }
    // 查询合同类型目录信息
    getFileSourceCategoryProductData() {
        this.$axios.post('/zhiguan/indexArticle/directory/product/query', { parentCode: '', indexType: '2' }).then((res: any) => {
            // 2,3层 合并为 '3'层
            this.fileSourceCategoryData[1].children = [
                { id: '5', label: '运作中(公募)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '6', label: '运作中(私募单一)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '7', label: '运作中(私募集合)', level: '3', indexType: '2', liquidation: '1', children: [] },
                { id: '8', label: '已清盘(公募)', level: '3', indexType: '2', liquidation: '2', children: [] },
                { id: '9', label: '已清盘(私募单一)', level: '3', indexType: '2', liquidation: '2', children: [] },
                { id: '10', label: '已清盘(私募集合)', level: '3', indexType: '2', liquidation: '2', children: [] },
            ];

            res.forEach(item => {
                this.fileSourceCategoryData[1].children.forEach((item2, index2) => {
                    if (item2.id == item.productTypes) {
                        item2.children.push({
                            id: item.indexDirectoryCode,
                            label: item.indexName,
                            parentCode: item.parentCode,
                            level: '4',
                            indexType: item.indexType,
                            productTypes: item.productTypes,
                            liquidation: item.liquidation,
                            productCode: item.productCode,
                            finish: item.finish,
                            setupDate: item.setupDate,
                        });
                    }
                });
            });
            // this.fileSourceCategoryData[1].children.sort(this.compare('finish', false));

            this.refreshKey += 1;
            this.$emit('emitFileSourceCategoryData', this.fileSourceCategoryData, this.refreshKey);
        });
    }
    // 查询条款列表信息--产品
    getIndexClauseListPro() {
        this.$axios
            .post('/zhiguan/indexClause/product/productList', {
                ...this.clauseQueryParamPro,
            })
            .then((res: any) => {
                if (res) {
                    this.clauseQueryDialog = false;
                    this.indexClauseProductList = [];
                    this.clauseCodes = [];
                    res.list.forEach(item => this.indexClauseProductList.push(item));
                    this.groupPageProduct.total = res.total;
                    if (res.list.length != 0) {
                        this.indexClauseRelationProduct = res.list[0];
                    } else {
                        this.indexClauseRelationProduct = { clauseCode: '' };
                    }
                }
                this.clauseCodesList = [];
                this.clauseCodesListProduct = [];
            });
    }
    emitRefreshChild() {
        this.getIndexClauseList('');
    }
    // 查询条款列表信息
    getIndexClauseList(param) {
        let clauseQueryParam = JSON.parse(JSON.stringify(this.clauseQueryParam));
        if (sessionStorage.getItem('jumpParam-clauseCode') || sessionStorage.getItem('jumpParam-defaultFundCode')) {
            // 说明是第一次进来 由于缺失树节点的其他字段(indexType) 这次请求忽略
            return;
        }
        if (this.treeNodeData.indexType != '2') {
            this.$axios.post('/zhiguan/indexClause/list', clauseQueryParam).then((res: any) => {
                if (res) {
                    this.clauseQueryDialog = false;
                    this.indexClauseList = [];
                    this.groupPage.total = res.total;
                    this.$nextTick(() => {
                        if (res.list.length != 0) {
                            this.indexClauseRelation = res.list[0];
                        } else {
                            this.indexClauseRelation = { clauseCode: '' };
                        }
                        res.list.forEach(item => this.indexClauseList.push(item));
                        if (param != 'refresh') {
                            this.clauseCodes = [];
                        } else {
                            let rows = [];
                            res.list.forEach(item => {
                                if (this.clauseCodes.includes(item.clauseCode)) {
                                    rows.push(item);
                                }
                            });
                            (this.$refs.upstreamTable as any).setCheckboxRow(rows, true);
                        }
                    });
                    // this.goFirst = false;
                }
                // this.goClauseCode = '';
            });
        } else if (this.treeNodeData.indexType == '2') {
            this.$axios.post('/zhiguan/indexClause/list', clauseQueryParam).then((res: any) => {
                if (res) {
                    this.clauseQueryDialog = false;
                    this.indexClauseList = [];
                    this.groupPage.total = res.total;
                    this.$nextTick(() => {
                        if (res.list.length != 0) {
                            this.indexClauseRelation = res.list[0];
                        } else {
                            this.indexClauseRelation = { clauseCode: '' };
                        }
                        res.list.forEach(item => this.indexClauseList.push(item));
                        if (param != 'refresh') {
                            this.clauseCodes = [];
                        } else {
                            let rows = [];
                            res.list.forEach(item => {
                                if (this.clauseCodes.includes(item.clauseCode)) {
                                    rows.push(item);
                                }
                            });
                            (this.$refs.upstreamTable as any).setCheckboxRow(rows, true);
                        }
                    });
                    // this.goFirst = false;
                }
                // this.goClauseCode = '';
            });
        }
        this.clauseCodesList = [];
        this.clauseCodesListProduct = [];
    }
    // 刷新数据
    getIndexClauseListRefresh() {
        if (this.tabPaneType == 'File') {
            this.getIndexClauseList('refresh');
            (this.$refs['source'] as any).getTableData();
        } else if (this.tabPaneType == 'Product') {
            this.getIndexClauseListPro();
        }
    }
    // 条款btn---新增、复制
    handleClauseBtn(type) {
        if (type == '复制' && this.clauseCodes.length == 0) {
            this.yh_message_warn('选择条款不可为空！');
            return;
        }
        if (type == '复制' && this.checkItemIs == true) {
            this.yh_message_warn('存在未复核条款！');
            return;
        }
        if (this.clauseCodes.length == 1 && type == '复制' && this.MenuName == '监管类') {
            this.sourceSettteingType = '单个复制';
        } else if (this.clauseCodes.length == 1 && type == '复制' && this.MenuName == '制度解读类') {
            this.sourceSettteingType = '单个复制制度解读类';
        } else if (this.clauseCodes.length > 1 && type == '复制') {
            this.sourceSettteingType = '多个复制';
        } else {
            this.sourceSettteingType = type;
        }
        this.addTreatyDialog = true;
    }
    // 产品条款复制btn
    handleProductClauseBtn() {
        if (this.checkItemIs == true) {
            this.yh_message_warn('存在未复核条款！');
            return;
        }
        this.serialClauseDialog = true;
    }
    delClauseDialog(clauseCodes, param2) {
        if (this.clauseCodes.length == 0 && param2 == '批量删除') {
            this.yh_message_warn('选择条款不可为空！');
            return;
        }
        if (this.checkItemIs == true && param2 == '批量删除') {
            this.yh_message_warn('存在未复核条款！');
            return;
        }
        this.delConfirmationDialog = true;
        this.delType.type = param2;
        if (param2 == '单个删除') {
            this.delType.content = clauseCodes.clauseCode;
        } else {
            this.delType.content = '';
        }
    }
    // 条款删除
    delClause() {
        let data = [];
        if (this.delType.type == '批量删除') {
            data = this.clauseCodes;
        } else if (this.delType.type == '单个删除') {
            data.push(this.delType.content);
        }
        this.$axios
            .post('/zhiguan/indexClause/delete', { clauseList: data })
            .then((res: any) => {
                this.delConfirmationDialog = false;
                this.yh_message_success('删除成功！');
                this.clauseQueryParam.paging.currentPage = 1;
                this.clauseQueryParam.paging.pageSize = 50;
                if (this.tabPaneType == 'File') {
                    this.getIndexClauseList('');
                    // 刷新树之前 获取当前展开的节点
                    this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
                    this.getFileSourceCategoryData();
                } else if (this.tabPaneType == 'Product') {
                    this.getIndexClauseListPro();
                    // 刷新树之前 获取当前展开的节点
                    this.treeExpandKeys2 = (this.$refs['left-tree'] as any).getCurrentKey2();
                    this.getFileSourceCategoryProData();
                }
            })
            .catch(() => {
                this.delConfirmationDialog = false;
            });
    }
    // 启用、停用条款
    enableClause(type) {
        if (this.clauseCodes.length == 0 && type != '导入' && this.tabPaneType == 'File') {
            this.yh_message_warn('选择条款不可为空！');
            return;
        }
        if (this.clauseCodesProduct.length == 0 && type != '导入' && this.tabPaneType == 'Product') {
            this.yh_message_warn('选择条款不可为空！');
            return;
        }
        let clauseList = [];
        if (this.tabPaneType == 'File') {
            clauseList = this.clauseCodes;
        } else if (this.tabPaneType == 'Product') {
            clauseList = this.clauseCodesProduct;
        }
        if (type == '启用') {
            this.$axios.post('/zhiguan/indexClause/updateClauseStatus', { clauseList: clauseList, clauseStatus: '1' }).then((res: any) => {
                if (this.tabPaneType == 'File') {
                    this.clauseCodes = [];
                    this.getIndexClauseList('');
                } else if (this.tabPaneType == 'Product') {
                    this.clauseCodesProduct = [];
                    this.getIndexClauseListPro();
                }
                this.yh_message_success('启用成功！');
            });
        } else if (type == '停用') {
            this.$axios.post('/zhiguan/indexClause/updateClauseStatus', { clauseList: clauseList, clauseStatus: '0' }).then((res: any) => {
                if (this.tabPaneType == 'File') {
                    this.clauseCodes = [];
                    this.getIndexClauseList('');
                } else if (this.tabPaneType == 'Product') {
                    this.clauseCodesProduct = [];
                    this.getIndexClauseListPro();
                }
                this.yh_message_success('停用成功！');
            });
        } else if (type == '导入') {
            this.importFileDialog = true;
        }
    }

    /**
     * 恒生待办 or 事后待办
     */
    handleHsOrSh(type) {
        // let clauseQueryParam = {
        //     // 列表查询条件
        //     articleCode: this.clauseQueryParam.articleCode,
        //     articleCode1: '',
        //     belongFund: '',
        //     clauseCode: '',
        //     clauseNo: '',
        //     clauseSourceCode: '',
        //     clauseStatus: '',
        //     clauseText: '',
        //     clauseTextLike: '',
        //     clauseType: '',
        //     hdSupport: '',
        //     paging: {
        //         currentPage: 1,
        //         pageSize: 50,
        //     },
        //     passiveTransfinite: '',
        //     realTimeSupport: '',
        //     status: '',
        //     suitableFund: '',
        //     versionNumber: '',
        //     versionNumbers: [],
        //     versionValid: '',
        //     indexType: this.clauseQueryParam.indexType,
        //     indexDirectoryCode: '',
        //     liquidation: '',
        //     directoryCode: '',
        //     directoryCode1: '',
        //     sourceName: '',
        //     pcProductType: [],
        //     ptProductType1: [],
        //     directoryCode1Str: '',
        //     taskType: '',
        //     hsSupport: '',
        //     shSupport: '',
        //     specialProductsList: [],
        // };

        // this.clauseQueryParam = clauseQueryParam;
        if (type === '恒生交易系统待办') {
            if (this.taskType2) {
                this.clauseQueryParam.taskType = '';
            } else {
                this.clauseQueryParam.taskType = '2';
            }
            this.taskType2 = !this.taskType2;
            this.taskType3 = false;
        }
        if (type === '事后系统待办') {
            if (this.taskType3) {
                this.clauseQueryParam.taskType = '';
            } else {
                this.clauseQueryParam.taskType = '3';
            }
            this.taskType3 = !this.taskType3;
            this.taskType2 = false;
        }
        this.getIndexClauseList('');
    }

    // 条款原文模糊搜索
    clauseTextLikeQuery(param) {
        if (this.tabPaneType == 'Product') {
            console.log('搜索Product');
            this.debounce(this.getIndexClauseListPro, 500);
        } else if (this.tabPaneType == 'File') {
            console.log('搜索File');
            this.debounce(this.getIndexClauseList, 500);
        }
    }
    // 条款高级查询btn
    clauseAdvancedQuery() {
        this.clauseQueryDialog = true;
    }
    // 导出
    downLoadGroupFileBtn() {
        if (this.indexClauseList.length == 0 && this.tabPaneType == 'File') {
            this.yh_message_warn('当前数据为空!');
            return;
        }
        if (this.indexClauseProductList.length == 0 && this.tabPaneType == 'Product') {
            this.yh_message_warn('当前数据为空!');
            return;
        }
        if (this.tabPaneType == 'File') {
            if (this.clauseCodes.length > 0) {
                downLoadFile({
                    url: '/zhiguan/indexClause/export',
                    method: 'post',
                    data: {
                        clauseList: this.clauseCodes,
                    },
                });
            } else if (this.clauseCodes.length == 0) {
                downLoadFile({
                    url: '/zhiguan/indexClause/export',
                    method: 'post',
                    data: {
                        ...this.clauseQueryParam,
                    },
                });
            }
        } else if (this.tabPaneType == 'Product') {
            if (this.clauseCodesProduct.length > 0) {
                downLoadFile({
                    url: '/zhiguan/indexClause/export',
                    method: 'post',
                    data: {
                        clauseList: this.clauseCodesProduct,
                        productType: '1',
                    },
                });
            } else if (this.clauseCodes.length == 0) {
                downLoadFile({
                    url: '/zhiguan/indexClause/export',
                    method: 'post',
                    data: {
                        ...this.clauseQueryParamPro,
                        productType: '1',
                        indexType: '2',
                    },
                });
            }
        }
    }
    // 条款多选
    clauseChangeEvent(checked, row, rowIndex) {
        this.clauseCodes = [];
        this.clauseCodesList = [];
        this.checkItemIs = false;
        if (checked.selection.length != 0) {
            for (let i = 0; i < checked.selection.length; i++) {
                this.clauseCodes.push(checked.selection[i].clauseCode);
                this.clauseCodesList.push(checked.selection[i]);
            }
            for (let i = 0; i < checked.selection.length; i++) {
                if (checked.selection[i].modifyEvent) {
                    this.checkItemIs = true;
                    return;
                }
            }
        } else {
            this.checkItemIs = false;
        }
    }
    // 条款多选 -- 产品维度
    clauseChangeEventProduct(checked, row, rowIndex) {
        this.clauseCodesProduct = [];
        this.clauseCodesListProduct = [];
        for (let i = 0; i < checked.selection.length; i++) {
            this.clauseCodesProduct.push(checked.selection[i].clauseCode);
            this.clauseCodesListProduct.push(checked.selection[i]);
        }
    }
    // 编辑条款
    openhandleClauseDialog(scope, type) {
        this.addTreatyDialog = true;
        this.sourceSettteingType = type;
        this.clauseCodeItem.clauseCode = scope.clauseCode;
        this.clauseCodeItem.indexSourceCode = scope.indexSourceCode;
        this.clauseCodeItem.articleCode = scope.articleCode;
        console.log(type, 'type');

        console.log(this.sourceSettteingType, 'this.sourceSettteingType');
    }
    // 编辑条款--产品
    openhandleClauseDialogProduct(scope, type) {
        this.addTreatyDialog = true;
        this.clauseCodeItem.clauseCode = scope.clauseCode;
        this.clauseCodeItem.articleCode = scope.articleCode;
        // this.sourceSettteingType = type;
        if (scope.indexType == '1') {
            this.sourceSettteingType = '监管类' + type;
        } else if (scope.indexType == '2') {
            this.sourceSettteingType = '合同类' + type;
        } else if (scope.indexType == '3') {
            this.sourceSettteingType = '制度解读类' + type;
        }
    }
    // 删除条款
    handleClauseRemove(param1, param2) {
        if (param2 == '单个删除') {
        }
    }
    // 单击合规条款table行
    handleRow(row, event, column) {
        this.indexClauseRelation = row.row;
    }
    handleRowProduct(row, event, column) {
        this.indexClauseRelationProduct = row.row;
    }
    // 产品条款迁移成功
    emitCopyProduct() {
        this.getIndexClauseList('');
    }
    emitHandleVaild() {
        // 刷新树之前 获取当前展开的节点
        this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
        // 查询来源目录信息
        this.getFileSourceCategoryData();
        // 产品维度
        this.getFileSourceCategoryProData();
        // 条款列表
        this.getIndexClauseList('');
    }
    deleteAllList(param) {
        let fileSourceCategoryData = [
            { id: '0', label: '监管类', level: '1', indexType: '1', children: [] },
            { id: '1', label: '合同类', level: '1', indexType: '2', children: [] },
            { id: '2', label: '公司制度解读类', level: '1', indexType: '3', children: [] },
        ];
        this.handleNodeClick(fileSourceCategoryData[Number(param.indexType) - 1], {});
    }
    // 新增来源文件弹窗 emit
    emitAddSourceDialog(param) {
        this.addSourceDialog = param;
    }
    // 合约条款新增弹窗emit
    emitTreatyArticle(param1, param2) {
        this.addTreatyDialog = param1;
        if (param2 == 'query') {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            console.log('treeExpandKeys(当前展开的节点):', this.treeExpandKeys);

            this.getFileSourceCategoryData();

            this.clauseQueryParam.paging.currentPage = 1;
            this.clauseQueryParam.paging.pageSize = 50;
            this.getIndexClauseList('');
        }
    }
    // 左侧菜单节点名称编辑
    emitIconEdit(param) {
        this.indexItem = param;
        this.categoryNodeDialog = true;
        this.categoryNodeType = '修改';
    }

    MenuNameCopy: string = '监管类'; // 使用另外一个变量 不然会影响其他组件的menuname

    // 左侧菜单条目节点编辑emit
    emitIconEditOutline(param1, param2) {
        this.indexItem = param1;
        if (param1.indexType == '2') {
            this.MenuNameCopy = '合同类';
        } else if (param1.indexType == '3') {
            this.MenuNameCopy = '制度解读类';
        } else if (param1.indexType == '1') {
            this.MenuNameCopy = '监管类';
        }
        this.addSourceDialog = true;
    }
    // 左侧菜单条目节点添加emit
    emitIconPlus(param) {
        this.categoryNodeDialog = true;
        this.categoryNodeType = '新增';
        this.indexItem = param;
    }
    // 获取指标来源操作日志
    emitIconTime(param) {
        this.entryRecordItem = param;
        this.entryRecordDialog = true;
    }
    // 条目记录弹窗emit
    emitEntryRecordDialog(param) {
        this.entryRecordDialog = param;
    }
    // 新增来源文件弹窗emit
    emitSource(param, param2) {
        if (param2 == true) {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            this.getFileSourceCategoryData();
        }
        this.addSourceDialog = param;
    }
    emitSource2(param, param2) {
        if (param2 == true) {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            this.getFileSourceCategoryData();
        }
    }
    // 高级查询弹窗emit
    emitClauseQuery(param1, param2) {
        if (param2 == '') {
            this.clauseQueryDialog = param1;
        } else if (param2 != '') {
            this.clauseQueryParam.directoryCode1 = param2.directoryCode1;
            this.clauseQueryParam.clauseStatus = param2.clauseStatus;
            this.clauseQueryParam.sourceName = param2.sourceName;
            this.clauseQueryParam.versionNumber = param2.versionNumber;
            this.clauseQueryParam.versionNumbers = param2.versionNumbers;
            this.clauseQueryParam.pcProductType = param2.pcProductType;
            this.clauseQueryParam.ptProductType1 = param2.ptProductType1;
            this.clauseQueryParam.clauseNo = param2.clauseNo;
            this.clauseQueryParam.passiveTransfinite = param2.passiveTransfinite ? param2.passiveTransfinite : '';
            this.clauseQueryParam.realTimeSupport = param2.realTimeSupport;
            this.clauseQueryParam.hdSupport = param2.hdSupport;
            this.clauseQueryParam.clauseType = param2.clauseType;
            this.clauseQueryParam.articleCode1 = param2.articleCode1;
            this.clauseQueryParam.directoryCode1Str = param2.directoryCode1Str;
            this.clauseQueryParam.hsSupport = param2.hsSupport;
            this.clauseQueryParam.shSupport = param2.shSupport;
            this.clauseQueryParam.specialProductsList = param2.specialProductsList;

            this.getIndexClauseList('');
        }
    }
    emitClauseQueryProduct(param1, param2) {
        if (param2 == '') {
            this.clauseQueryDialog = param1;
        } else if (param2 != '') {
            this.clauseQueryParamPro.directoryCode1Str = param2.directoryCode1Str;
            this.clauseQueryParamPro.clauseStatus = param2.clauseStatus;
            this.clauseQueryParamPro.sourceName = param2.sourceName;
            this.clauseQueryParamPro.versionNumber = param2.versionNumber;
            this.clauseQueryParamPro.clauseNo = param2.clauseNo;
            this.clauseQueryParamPro.passiveTransfinite = param2.passiveTransfinite ? param2.passiveTransfinite : '';
            this.clauseQueryParamPro.realTimeSupport = param2.realTimeSupport;
            this.clauseQueryParamPro.hdSupport = param2.hdSupport;
            this.clauseQueryParamPro.clauseType = param2.clauseType;
            this.clauseQueryParamPro.articleCode1 = param2.articleCode1;
            this.clauseQueryParamPro.versionNumbers = param2.versionNumbers;
            this.getIndexClauseListPro();
        }
    }
    // 来源名称节点新增、编辑
    emitCategoryNodeDialog(param1, param2) {
        this.categoryNodeDialog = param1;
        if (param2 == '刷新接口') {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            this.getFileSourceCategoryData();
        }
    }
    // 系列条款弹窗额emit
    emitSerialClauseDialog(param) {
        this.serialClauseDialog = param;
    }
    // 删除确认窗口显示
    emitDialogVisible(param) {
        this.delConfirmationDialog = param;
    }
    // 删除确认窗口
    emitHandleBtn() {
        if (['批量删除', '单个删除'].includes(this.delType.type)) {
            this.delClause();
        }
    }
    // 合规条款导入
    emitImportFile(param, param2) {
        if (param2 == true) {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            this.getFileSourceCategoryData();
        }
        this.importFileDialog = param;
        this.getIndexClauseListRefresh();
    }
    emitTabpaneType(param) {
        this.tabPaneType = param;
        this.clauseQueryDialog = false;
        this.layoutDialog = false;
        if (param == 'File') {
            this.queryLayout();
        } else if (param == 'Product') {
            this.queryLayoutProduct();
            this.activeTab = 'clause';
        }
    }
    // 分页
    private pageRet(): void {
        this.clauseQueryParam.paging.currentPage = this.groupPage.currentPage;
        this.clauseQueryParam.paging.pageSize = this.groupPage.pageSize;
        this.getIndexClauseList('');
    }
    // 分页indexClauseProductList
    private pageRetProduct(): void {
        this.clauseQueryParamPro.paging.currentPage = this.groupPageProduct.currentPage;
        this.clauseQueryParamPro.paging.pageSize = this.groupPageProduct.pageSize;
        this.getIndexClauseListPro();
    }
    filterChangeEvent() {}
    // 防抖
    debounce(fun, time = 500) {
        if (this.timeout) {
            clearTimeout(this.timeout);
        }
        this.timeout = setTimeout(() => {
            fun();
        }, time);
    }
    // 条款点击行单元格样式
    cellStyle({ row, column, rowIndex, columnIndex }) {
        if (row.clauseCode == this.indexClauseRelation.clauseCode) {
            return { background: '#faf2ea' };
        }
    }
    // 条款点击行单元格样式
    cellProductStyle({ row, column, rowIndex, columnIndex }) {
        if (row.clauseCode == this.indexClauseRelationProduct.clauseCode) {
            return { background: '#faf2ea' };
        }
    }
    /**
     * 提交成功后回调
     * @param {Object} 回调数据
     */
    async onSubmit(data) {
        await this.queryLayout();
    }
    // 获取页面布局信息
    async queryLayout() {
        let param;
        if (this.treeNodeData.indexType == '1') {
            this.tableName = 'ENTRY_STANDARD_LIBRARY_CLAUSE1';
        } else if (this.treeNodeData.indexType == '2') {
            this.tableName = 'ENTRY_STANDARD_LIBRARY_CLAUSE2';
        } else if (this.treeNodeData.indexType == '3') {
            this.tableName = 'ENTRY_STANDARD_LIBRARY_CLAUSE3';
        }
        this.calcLoading = true;
        const resList: any = await new Promise((resolve, reject) => {
            getTableLayout(this.tableName)
                .then((res: any) => {
                    resolve(res);
                })
                .catch(err => {
                    reject(err);
                });
        });
        if (resList) {
            this.selectedFieldList = JSON.parse(resList);
            this.showFieldList = this.fixedFieldList.concat(this.selectedFieldList);
            this.calcLoading = false;
        } else {
            this.showFieldList = this.tableColumns;
            this.selectedFieldList = this.tableColumns;
            this.calcLoading = false;
        }
        // 重新渲染表格
        this.tableKey++;
        // this.changeTable();
    }
    /**
     * 提交成功后回调
     * @param {Object} 回调数据
     */
    async onSubmitProduct(data) {
        await this.queryLayoutProduct();
    }
    // 获取页面布局信息-- 产品
    async queryLayoutProduct() {
        this.calcLoading = true;
        const resList: any = await new Promise((resolve, reject) => {
            getTableLayout('ENTRY_STANDARD_LIBRARY_CLAUSE4')
                .then((res: any) => {
                    resolve(res);
                })
                .catch(err => {
                    reject(err);
                });
        });
        if (resList) {
            this.selectedFieldListProduct = JSON.parse(resList);
            this.showFieldListProduct = this.fixedFieldListProduct.concat(this.selectedFieldListProduct);
            this.calcLoading = false;
        } else {
            this.showFieldListProduct = this.tableColumns4;
            this.selectedFieldListProduct = this.tableColumns4;
            this.calcLoading = false;
        }
        // 重新渲染表格
        this.tableKeyProduct++;
        // this.changeTable();
    }
    changeTable() {
        const _this = this;
        this.$nextTick(() => {
            let iconDom = (_this.$refs['upstreamTable'] as any).$el.querySelectorAll('.vxe-icon--funnel');
            for (let i: any = 0; i < iconDom.length; i++) {
                if (['来源名称', '条款原文'].includes(iconDom[i].parentNode.parentNode.children[0].innerHTML)) {
                    iconDom[i].className = 'vxe-filter--btn el-icon-search';
                }
            }
        });
    }
    // 转表格筛选下拉框数据
    objToArr(param) {
        const list = [];
        for (const key in param) {
            list.push({ label: param[key], value: key });
        }
        return list;
    }
    // 表格列筛选数据
    filterHandler({ option, row, column }) {
        const property = column['property'];
        return row[property].includes(option.data);
    }
    emitIconEditTest(node, data) {
        let nodeNew = {
            parentId: data.id, // 来源类型
            label: '新增分类', // 指标来源名称
        };
        data.children.push(nodeNew);
        this.$axios.post('/indexSource/addFileSourceCategoryNode', { ...nodeNew }).then((res: any) => {
            if (res) {
                this.yh_message_success('新增成功!');
                // 刷新树之前 获取当前展开的节点
                this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
                this.getFileSourceCategoryData();
            }
        });
    }
    async emitNodeEdit(param1, param2, param3) {
        if (param2 == '刷新接口') {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            await this.getFileSourceCategoryData();
        } else if (param2 == '刷新接口2') {
            // 刷新树之前 获取当前展开的节点
            this.treeExpandKeys = (this.$refs['left-tree'] as any).getCurrentKey();
            await this.getFileSourceCategoryData();
            let fileSourceCategoryData = [
                { id: '0', label: '监管类', level: '1', indexType: '1', children: [] },
                { id: '1', label: '合同类', level: '1', indexType: '2', children: [] },
                { id: '2', label: '公司制度解读类', level: '1', indexType: '3', children: [] },
            ];
            this.handleNodeClick(fileSourceCategoryData[Number(param3.indexType) - 1], {});
        }
    }
    resetClauseQueryParam() {
        this.clauseQueryParam = {
            // 列表查询条件
            articleCode: '',
            articleCode1: '',
            belongFund: '',
            clauseCode: '',
            clauseNo: '',
            clauseSourceCode: '',
            clauseStatus: '',
            clauseText: '',
            clauseTextLike: '',
            clauseType: '',
            hdSupport: '',
            paging: {
                currentPage: 1,
                pageSize: 50,
            },
            passiveTransfinite: '',
            realTimeSupport: '',
            status: '',
            suitableFund: '',
            versionNumber: '',
            versionNumbers: [],
            versionValid: '',
            indexType: '',
            indexDirectoryCode: '',
            liquidation: '',
            directoryCode: '',
            directoryCode1: '',
            sourceName: '',
            pcProductType: [],
            ptProductType1: [],
            directoryCode1Str: '',
            taskType: '',
            hsSupport: '',
            shSupport: '',
            specialProductsList: [],
        };
        this.taskType2 = false;
        this.taskType3 = false;
    }
    resetClauseQueryParamPro() {
        this.clauseQueryParamPro = {
            // 列表查询条件
            articleCode: '',
            articleCode1: '',
            belongFund: '',
            clauseCode: '',
            clauseNo: '',
            clauseSourceCode: '',
            clauseStatus: '',
            clauseText: '',
            clauseTextLike: '',
            clauseType: '',
            hdSupport: '',
            paging: {
                currentPage: 1,
                pageSize: 50,
            },
            passiveTransfinite: '',
            realTimeSupport: '',
            status: '',
            suitableFund: '',
            versionNumber: '',
            versionNumbers: [],
            versionValid: '',
            indexType: '',
            indexDirectoryCode: '',
            fundDirectoryCode: '',
            liquidation: '',
            directoryCode: '',
            directoryCode1Str: '',
            sourceName: '',
            pcProductType: [],
            ptProductType1: [],
            productType: '',
            productTypes: '',
        };
    }

    // 根据某字段排序
    compare(property, desc) {
        return function (a, b) {
            var value1 = a[property];
            var value2 = b[property];
            if (desc == true) {
                // 升序排列
                return value1 - value2;
            } else {
                // 降序排列
                return value2 - value1;
            }
        };
    }

    /**
     * 右边TAB切换事件
     */
    handleTabChange(ele) {
        if (ele.name === 'source') {
            (this.$refs['source'] as VueObject).getTableData();
        } else if (ele.name === 'clause') {
            this.getIndexClauseList('');
        }
    }
    getPcProductType2(value) {
        let arr = [];
        if (value.length > 0) {
            value.forEach(item => {
                arr.push(this.PCPRODUCTTYPE2[item]);
            });
        }
        return arr.join(',');
    }
}
</script>
<style lang="scss" scoped>
#compliance-clause {
    height: 100%;
    display: flex;
    .content {
        // width: calc(100% - 260px);
        min-width: 1050px;
        overflow: auto;
        position: relative;

        .content-top {
            height: 50%;
            min-height: 350px;
        }

        .content-bottom {
            height: calc(50% - 50px);
            min-height: 300px;
        }
    }
}
.operate {
    height: 100%;
    .operate-btn {
        width: 98%;
        display: flex;
        justify-content: space-between;
        margin: 10px auto;
    }
}
.index-clause /deep/ .vxe-table {
    .vxe-table--main-wrapper {
        height: 100%;
    }
    .vxe-table--body-wrapper {
        height: calc(100% - 40px);
    }
}

.toggle-btn {
    position: absolute;
    top: 50%;
    z-index: 100;
    cursor: pointer;
    left: 0;
    margin-top: -25px;
}

.shrink-right-icon {
    background-color: #acb7c1;
    width: 10px;
    height: 50px;
    line-height: 50px;
    font-weight: 700;
    font-size: 12px;
    border-top-right-radius: 50px;
    border-bottom-right-radius: 50px;
}

.shrink-right-icon i {
    position: absolute;
    top: 18px;
    left: -2px;
}

// .el-icon-arrow-left:before {
//     content: '\e6de';
// }

.separator1 {
    position: relative;
    display: inline-block;
    width: 1px;
    height: 17px;
    margin: 0 15px;
}

.separator1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(229, 229, 229, 1);
    height: 26px;
}

.content-tabs /deep/ .el-tabs__nav .el-tabs__item {
    height: 40px !important;
    line-height: 40px !important;
}

/deep/ .el-button--mini {
    padding: 8px 9px;
}

/deep/ .el-input__inner {
    font-size: 12px;
}

/deep/ .el-divider--horizontal {
    width: calc(100% - 30px);
    margin: 0 15px;
}

/deep/ .el-link.el-link--default {
    padding: 0 5px;
    margin-top: -5px;
}

// 启用状态
.status-style {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-style-blue {
    background-color: #4787f0;
}

.status-style-red {
    background-color: #e0251e;
}
</style>
